var template = "<div class='modal'>"+
			   		"<div class='modal-dialog'>"+
			   			"<div class='modal-content'>"+
			   				"<div class='modal-header'>"+
			   					"<div class='close' data-dismiss='modal'>&times;</div>"+
			   					"<h4 class='modal-title'>消息</h4>"+
			   				"</div>"+
			   				"<div class='modal-body'>"+
			   					"消息内容"+
			   				"</div>"+
			   				"<div class='modal-footer'>"+
			   					"xxxx"+
			   				"</div>"+
			   			"</div>"+
			   		"</div>"+
		   		"</div>";
var logTemplate = "<form class='form-horizontal' id='loginForm'>"+
						"<div class='form-group'>"+
							"<label for='loginInput' class='col-xs-3 control-label login'>登录名:</label>"+
							"<div class='col-xs-9'>"+
								"<div class='input-group'>"+
									"<div class='input-group-addon'>"+
										"<span class='glyphicon glyphicon-user'></span>"+
									"</div>"+
									"<input class='form-control' id='loginInput' name='login' placeholder='登录名' required='required'>"+
								"</div>"+
							"</div>"+
						"</div>"+
						"<div class='form-group'>"+
							"<label for='passwordInput' class='col-xs-3 control-label password'>密码:</label>"+
							"<div class='col-xs-9'>"+
								"<div class='input-group'>"+
									"<div class='input-group-addon'>"+
										"<span class='glyphicon glyphicon-lock'></span>"+
									"</div>"+
									"<input class='form-control' id='passwordInput' name='password' placeholder='密码' type='password' required='required'>"+
								"</div>"+
							"</div>"+
						"</div>"+
					"</form>"
var dialog = $(template);
var logDia = $(logTemplate);
dialog.on('hide.bs.modal',function(){
	this.remove();
});
dialog.find('.modal-dialog').css({"margin-top":"100px"});
dialog.find('.modal-title').css({"font-weight":"600","font-family":"微软雅黑"});
jQuery.extend({
	message : function(title,content){
		dialog.find('.modal-dialog').css({"width":"300px"});
		dialog.find('.modal-title').html(title);
		dialog.find('.modal-body').html(content);
		var footer = "<button class='btn btn-default' data-dismiss='modal' id='mesConfirm'>确定</button>";
		dialog.find('.modal-footer').html(footer);
		dialog.modal('show');
		//dialog.find('.modal').show();
	},
	confirm : function(title,content){
		dialog.find('.modal-dialog').css({"width":"400px"});
		dialog.find('.modal-title').html(title);
		dialog.find('.modal-body').html(content);
		var footer = "<button class='btn btn-primary' id='confirmBtn'>确定</button>"+
						"<button class='btn btn-default' data-dismiss='modal'>取消</button>";
		dialog.find('.modal-footer').html(footer);
		dialog.modal('show');
	},
	fileinput : function(title){
		dialog.find('.modal-dialog').css({"width":"600px"});
		dialog.find('.modal-title').html(title);
		var content = "<input class='fileinput' id='file' type='file' name='file' />";
		dialog.find('.modal-body').html(content);
		var footer = "<button class='btn btn-default' data-dismiss='modal'>取消</button>";
		dialog.find('.modal-footer').html(footer);
		dialog.modal('show');
	},
	prompt : function(title){
		dialog.find('.modal-dialog').css({"width":"400px"});
		dialog.find('.modal-title').html(title);
		var content = "<input id='value' style='height:30px;border-radius:5px;' />";
		dialog.find('.modal-body').html(content);
		var footer = "<button class='btn btn-primary' id='confirmBtn'>确定</button>"+
						"<button class='btn btn-default' data-dismiss='modal'>取消</button>";
		dialog.find('.modal-footer').html(footer);
		dialog.modal('show');
	},
	login : function(title,logText,pwdText){
		logDia.find('label.login').html(logText);
		logDia.find('label.password').html(pwdText);
		dialog.find('.modal-dialog').css({"width":"400px"});
		dialog.find('.modal-title').html(title);
		dialog.find('.modal-body').html(logDia);
		var footer = "<button class='btn btn-primary' id='confirmBtn'>登录</button>"+
						"<button class='btn btn-default' data-dismiss='modal'>取消</button>";
		dialog.find('.modal-footer').html(footer);
		dialog.modal('show');
	}
});

jQuery.fn.extend({
	number : function(reg){
		var number = $(this).val();
		alert(reg.test(number)?true:false);
	}
});





















